package org.yy;

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

@Activate(group = {CommonConstants.CONSUMER, CommonConstants.PROVIDER})
public class DubboInvokeFilter implements Filter {


    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        RpcContext context = RpcContext.getContext();
        String ip = context.getRemoteHost();
//        System.out.println("ip=" + ip);
//        RpcContext.getContext().setAttachment("ip", ip);
        MyHolder.setRequest(ip);
        return invoker.invoke(invocation);
    }
}
